<?php echo Modules::run('content/header_content') ?>

<!--list grid view-->
<!--<script type="text/javascript">
	function imgLoaded(img){	
		$(img).parent().addClass('loaded');
	};
	$(function(){
		$('#itemContainer').mixitup({
			layoutMode: 'list', // Start in list mode (display: block) by default
			listClass: 'list', // Container class for when in list mode
			gridClass: 'grid', // Container class for when in grid mode
			transitionSpeed: 0,
			effects: ['fade','blur'], // List of effects 
			listEffects: ['fade','rotateX'] // List of effects ONLY for list mode
		});
		$('#ToList').on('click',function(){
			$('.button-view').removeClass('active');
			$(this).addClass('active');
			$('#itemContainer').mixitup('toList');
		});
		$('#ToGrid').on('click',function(){
			$('.button-view').removeClass('active');
			$(this).addClass('active');
			$('#itemContainer').mixitup('toGrid');
		});
		/*pagination*/
		$("div.holder").jPages({
		  containerID  : "itemContainer",
		  perPage      : 12,
		  startPage    : 1,
		  startRange   : 1,
		  midRange     : 5,
		  endRange     : 1
		});
		
	});
</script>-->




<div class="container main">
  <div>
    
    <div class="15">
      
      <div class="row">
        <?php foreach ($store as $keys => $vals) { ?>
        <div class="span5 sidebar">
          <div class="box box-pad2">
              <div class="shop-profile">
                <div class="pull-right">
                </div>
                
                <div class="shop-profile-img">
                <?php if($vals->logo == NULL){ ?>
                  <img width="48" height="48" src="<?php echo base_url('assets/img/no-image-100x100.png') ?>" title="No Image" alt="No Image">
                <?php }else{ ?>
                  <img width="48" height="48" src="<?php echo base_url('data/thumb/'.$vals->logo) ?>" title="<?php echo $vals->nama_toko ?>" alt="<?php echo $vals->nama_toko ?>">
                <?php } ?>
                </div>
                
                <div class="shop-profile-name clearfix">
                  <div>
                    <a href="<?php echo base_url('store/lists/'.$vals->toko_id) ?>" title="<?php echo $vals->nama_toko ?>">
                      <?php echo $vals->nama_toko ?>
                    </a>
                  </div>
                </div>
                <div class="shop-profile-desc ">
                  <?php echo $vals->description ?>                                  
                </div>
              </div>
              <div class="shop-profile">
                <div>
                  <?php echo $vals->alamat ?>
                </div>
                <div>
                </div>
                <div>
                  <?php echo $vals->kota ?>, <?php echo $vals->provinsi ?> <?php echo $vals->kode_pos ?>
                </div>
                <div>
                  <?php echo $vals->negara ?>
                </div>
                <div>
                  Telp : <?php echo $vals->telepon ?>
                </div>
                <div>
                  Hp : <?php echo $vals->hp ?>
                </div>
              </div>
             </div>
        </div>
        
        <div class="span10 content">
        <div class="storefront">
			
              <h3>
                    <?php echo $vals->nama_toko; ?>
              </h3>
              <?php }?>
         </div>
          <div class="row box-product-row box">
               <nav class="controls just">
				<div class="group" id="Sorts">
					<a href="<?php echo site_url('store/lists/'.$vals->toko_id); ?>"><div class="button-view" id="ToList"><i></i></div></a>
					<a href="<?php echo site_url('store/grid/'.$vals->toko_id); ?>"><div class="button-view active" id="ToGrid"><i></i></div></a>
                  <p class="group">
                    Sort by Price
                  </p>
                  <a href="<?php echo site_url('store/grid_high/'.$vals->toko_id); ?>">
                    <div class="button-price sort active" data-sort="data-price" data-order="asc">
                      <span><div class="arr_asc ib"></div></span>
                    </div></a>
                     <a href="<?php echo site_url('store/grid_low/'.$vals->toko_id); ?>">
                    <div class="button-price sort " data-sort="data-price" data-order="desc">
                      <span><div class="arr_desc ib"></div></span>
                    </div></a>
               </div>
              </nav>
            <h2>
              Products
            </h2>
            
            <div id="itemContainer" class="just grid">
            <?php $currency = $this->currency->getCurrency();?>
            <?php foreach ($product as $key => $val) { ?>

				<?php 
                $product_id = $val->product_id;
                //$price = number_format($val->price,2,',','.'); 
        		$price = $this->currency->format($val->price, $currency); 
        
                $product_name_length = strlen($val->product_name);
                $product_name_limit = $val->product_name;
        
                if ($product_name_length > 18){
                    $product_name_limit = substr($val->product_name, 0, 18) . '..';
                }
                
                ?>
            
              <div class="box-product box-product-list mix" style="display:inline-block; opacity:1;" data-price ="<?php echo $val->price ?>" data-store="#" data-product-id="<?php echo $product_id ?>" data-product-title="<?php echo $val->product_name; ?>">
                <div class="row">
                  	<div class="span3 meta img_wrapper" >
                        <a href="<?php echo site_url('product/detail/'.$val->product_seo_name); ?>">
                        <?php if($val->image_file == NULL) {?>
                          <img style="padding:10px;" src="<?php echo base_url('assets/img/no-image-100x100.png') ?>" title="No Image"/>
                        <?php }else{ ?>
                          <img src="<?php echo base_url('data/thumb/'.$val->image_file) ?>" title="<?php echo $val->product_name ?>  <?php echo $price ?>" 
                          alt="<?php echo $val->product_name ?>  <?php echo $price ?>">
                        <?php } ?>
                        </a>
                  	</div>
                    <div class="span5 meta product">
                        <div class="titles">
                          <a href="<?php echo site_url('product/detail/'.$val->product_seo_name); ?>" title="<?php echo $val->product_name ?>  <?php echo $price ?>">
                            <?php echo $product_name_limit ?>
                          </a>
                        </div>
                        <div class="desc">
                          <?php echo $val->description ?> 
                        </div>
                        <div class="shop">
                        <?php foreach ($store as $keys => $vals) { ?>
                        <?php if($vals->user_id == $val->user_id){ ?>
                          <a href="<?php echo base_url('store/lists/'.$vals->toko_id) ?>" title="<?php echo $vals->nama_toko ?>">
                            <?php echo $vals->nama_toko ?>
                          </a>
                        <?php } ?>
                        <?php } ?>
                        </div>
                    </div>
                    <div class="span2 meta price-item">
                           <?php echo $price ?>
                    </div>
                    <div class="span2 meta cart">
                        <a class="add_cart" data-product="<?php echo $product_id; ?>">Add to Cart</a>
                    </div>    
                    
                </div>
              </div>
			  <?php } ?>
            </div>
            <div class="clearfix">
            </div>
            <div class="storefront-bottom">
                <div id="paging_area" class="">
                    <center>
                      <?php echo $pagination; ?>
                    </center>
                </div>
                <!--<div class="storefront-show">
                </div>-->
              </div>
          </div>
          
        </div>
      </div>
    </div>
  </div>
</div>



<?php echo Modules::run('content/footer_content') ?>